const state = {
  userInfo: {},
}

const mutations = {
  setUserInfo(state, userInfo) {
    state.userInfo = userInfo
  },
}

const actions = {
  setUserInfo({ commit }, userInfo) {
    commit('setUserInfo', userInfo)
  }
}

const getters = {
  getUserInfo: state => state.userInfo,
  getUserInfoByKey: state => (key)=>state.userInfo[key]
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
